#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <string.h>
#include "zmalloc.h"

int main(int argc, char **argv)
{
	char *p = zmalloc(sizeof(char)*32);
	memset(p, 0, 32);
	strcpy(p, "hello world!");
	size_t mem = zmalloc_used_memory();
	printf("[%d]:%s--p:%s used:%d\n", getpid(), __FUNCTION__, p, mem);


	char *t = zmalloc(sizeof(char)*37);
	memset(t, 0, 37);
	strcpy(t, "it is beautiful");
	size_t mem2 = zmalloc_used_memory();
	printf("[%d]:%s--p:%s used:%d\n", getpid(), __FUNCTION__, t, mem2);
	zfree(p);
	mem2 = zmalloc_used_memory();
	printf("now used:%d\n", mem2);
	zfree(t);
	mem2 = zmalloc_used_memory();
	printf("now used2:%d\n", mem2);

	return 0;
}
